home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.4 Applications 1997 August / SGI IRIX 6.4 Applications 1997 August.iso / dist / mmailp.idb / usr / lib / Zmail / mp / mp.pro.l.ps.z / mp.pro.l.ps
Encoding:
Text File  |  1997-01-22  |  4.9 KB  |  186 lines

  1. %!PS-Adobe-1.0
  2. %%Creator: Steve Holden
  3. %%Modified: John Macdonald, Rich Burridge, Rainer Klute
  4. %%Modified: Bertrand Decouty, Bjorn P. Brox
  5. %%Title: @(#)mp.pro.l.ps 1.8 92/02/17
  6. %%CreationDate: see above
  7. %%PageLength 60
  8. %%LineLength 80
  9. %%NumCols 2
  10. %%DocumentFonts: Courier Helvetica-BoldOblique Times-Bold Times-Roman
  11. %%Pages: (atend)
  12. %%EndComments
  13.  
  14. /setpagepos      % pageno setpagepos --
  15. {
  16.   /leftedge 0 def
  17.   /bottomedge 0 def
  18.   /rightedge fullheight 2 div def
  19.   /topedge fullwidth def
  20.   2 mod 0 eq {
  21.     fullheight 2 div
  22.     dup /leftedge exch leftedge add def
  23.         /rightedge exch rightedge add def
  24.   } if
  25.   /ypos topedge 92 sub def
  26.   /xpos leftedge 46 add def
  27. } def
  28.  
  29.  
  30. /setmargin {
  31.   9 7 LandscapeMode { exch } if pop
  32.     /FontSize exch def
  33.  
  34.   /font1d /Times-Bold           reencodeISO
  35.   /font2d /Times-Roman          reencodeISO
  36.   /CourierISO /Courier          reencodeISO
  37.   /fontHd /Helvetica-BoldOblique        reencodeISO
  38.   /fontH2 /Helvetica-BoldOblique        reencodeISO
  39.   /fontNd /Times-Bold           reencodeISO
  40.   /font3d backspacefont
  41.  
  42.   /BoldFont      { /font1d findfont FontSize scalefont setfont } def
  43.   /pf            { /font2d findfont FontSize scalefont setfont } def
  44.   /sf            { /font3d findfont FontSize scalefont setfont } def
  45.   /fontH         { /fontHd findfont 10 scalefont setfont } def
  46.   /fontD         { /fontH2 findfont 8 scalefont setfont } def
  47.   /fontN         { /fontNd findfont 10 scalefont setfont } def
  48. } def
  49.  
  50. /graybox    % grey x1 y1 x2 y2 graybox --
  51. {
  52.     newpath
  53.       4 -1 roll 2 copy            % y2 x1
  54.       10 sub exch moveto
  55.       4 -1 roll 2 copy            % x1 y1
  56.       10 180 270 arc
  57.       4 -1 roll 1 copy 3 -1 roll    % x2 y1
  58.       10 270 0 arc
  59.       3 -1 roll 1 copy 3 1 roll        % x1 y2 x2 y2
  60.       10 0 90 arc
  61.       10 90 180 arc
  62.     closepath
  63.     gsave
  64.       setgray fill
  65.     grestore
  66.     0 setgray stroke
  67. } bind def
  68.  
  69. /dobanners                        % page_number dobanners --
  70. {
  71.   gsave
  72.     % listing type, user, date across the top
  73.     0.88                                % gray level
  74.     leftedge  50 add topedge 56 sub     % bottom lt corner
  75.     rightedge 95 sub topedge 36 sub     % top rt corner
  76.     graybox
  77.  
  78.     currentdict /sfactor known not
  79.     {
  80.       % determine a suitable factor to scale down the header text (done
  81.       % only once per document)
  82.       rightedge 95 sub leftedge 50 add sub % available space
  83.       fontD MailFor stringwidth pop
  84.       fontH User    stringwidth pop add
  85.             (  )    stringwidth pop add
  86.       fontD TimeNow stringwidth pop add    % total length of strings
  87.       div
  88.       dup 1 gt {pop 1} if                  % does it fit?
  89.       /sfactor exch def                    % if not scale down
  90.     }
  91.     if
  92.  
  93.     leftedge 50 add topedge 50 sub moveto
  94.     gsave
  95.     sfactor dup scale
  96.     fontD MailFor show
  97.     fontH User    show
  98.           (  )    show
  99.     grestore
  100.     fontD
  101.     rightedge 95 sub TimeNow stringwidth pop sfactor mul sub
  102.     topedge 50 sub moveto
  103.     gsave
  104.     sfactor dup scale
  105.     TimeNow show
  106.     grestore
  107.     % page number to the top right corner
  108.     1                                   % gray level
  109.     rightedge 70 sub topedge 56 sub     % bottom lt
  110.     rightedge 50 sub topedge 36 sub     % top rt
  111.     graybox
  112.     fontD
  113.     (Page) dup stringwidth
  114.        topedge 40 sub exch sub                  % y-centered
  115.        exch 2 div rightedge 60 sub exch sub     % x-centered
  116.        exch moveto show
  117.     fontH
  118.     dup stringwidth
  119.        topedge 58 sub exch sub                  % y-centered
  120.        exch 2 div rightedge 60 sub exch sub     % x-centered
  121.        exch moveto show
  122.     0.88                                   % gray level
  123.     leftedge  50 add bottomedge 50 add     % bottom lt corner
  124.     rightedge 50 sub bottomedge 70 add     % top rt corner
  125.     graybox
  126.     fontH
  127.     % compute x pos for centring
  128.       % ((l+50) + (r-50)) / 2 is the page centre
  129.       leftedge rightedge add 2 div
  130.       % but we want to start at the beginning of the string, not the middle
  131.       Subject stringwidth pop 2 div sub
  132.     % y pos is simple
  133.       bottomedge 54 add
  134.       moveto
  135.     Subject show
  136.   grestore
  137. } bind def
  138.  
  139. /endpage        % page_number endpage --
  140. {
  141.   pop
  142. %  PageSave restore      % restore *always* before showpage
  143.   showpage        % display it
  144. } bind def
  145.  
  146. /endcol            % page_number col_number endcol --
  147. {
  148.   /ColNo exch def
  149.   PageNo ColNo add 1 sub setpagepos
  150.   dobanners
  151.   PageNo ColNo add setpagepos
  152.   xpos ypos moveto
  153. } bind def
  154.  
  155. /newpage    % page_number newpage --
  156. {
  157.   2 mul 1 sub /PageNo exch def   % to be consistent with other prologues.
  158.   /ColNo 1 def
  159.   PageNo setpagepos
  160. %  /PageSave save def
  161.   LandscapeMode {setlandscape} if
  162.   /lct 0 def
  163.   xpos ypos moveto
  164.   sf
  165. } bind def
  166.  
  167. /setlandscape
  168. {
  169.   612 0 translate
  170.   90 rotate
  171. } bind def
  172.  
  173. /showline
  174. {
  175.   show
  176.   /ypos ypos FontSize sub def
  177.   xpos ypos moveto
  178. } bind def
  179.  
  180. % see the trouble shooting section in the README for details on setscreen.
  181. 106 45 {dup mul exch dup mul add 1.0 exch sub} setscreen
  182.  
  183. /LandscapeMode true def
  184.  
  185. setmargin
  186.